<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 导入md5加密相关的包 src="http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.js" 记住一定要在<head>里面导入 -->
    <script src="http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.js"></script>

</head>
<body>
    <form action="#" method="post">
        <span>用户名：</span><input type="text" id="username" name="username">
        <br>
        <span>密码：</span><input type="password" id="pwd" name="password">
        <br>
        <button type="submit" onclick="md5Encryption()">提交</button>
    </form>

    <script>

        // 表单检测函数，用于进行md5加密
        function md5Encryption(){
            // 获取普通表单的Dom
            let username_input = document.getElementById('username');
            let pwd = document.getElementById('pwd');

            pwd.value = md5(pwd.value)
            console.log(username_input.value);
            console.log(pwd.value);

        }
    </script>
</body>
</html>
